package org.ceteca.explica.core.partners;

import java.io.Serializable;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.ceteca.explica.core.common.BaseVO;



/**
 * @author Juan C. Díaz (juancarlosdiaz@ceteca.net) <br>
 *         Copyright (c) 2009 Fundación Centro Tecnolóxico da Carne
 * 
 * <br>
 * <br>
 *         This program is free software: you can redistribute it and/or modify
 *         it under the terms of the GNU General Public License as published by
 *         the Free Software Foundation, either version 3 of the License, or (at
 *         your option) any later version. <br/>
 *         This program is distributed in the hope that it will be useful, but
 *         WITHOUT ANY WARRANTY 
 *         <br>without even the implied warranty of
 *         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 *         General Public License for more details. <br/>
 *         You should have received a copy of the GNU General Public License
 *         along with this program. If not, see <http://www.gnu.org/licenses/>.
 * 
 */
public class PaymentMethodOT extends BaseVO implements Serializable {



	private static final long serialVersionUID = 1L;
	private long idPaymentMethod;
	private String description;
	private boolean cash, batch;
	private long daysFirstPayment, numberPayments, daysBetweenPayments;
	
	private Integer version=new Integer(0);

	public PaymentMethodOT() {
		super();


	}

	
	





	public String getDescription() {
		return description;
	}






	public void setDescription(String description) {
		this.description = description;
	}






















	public Integer getVersion() {
		return version;
	}









	@Override
	public boolean equals(Long id) {
		return id != null && this.idPaymentMethod == id.longValue();
	}

	@Override
	public String getEntityId() {
		return InterfacePartners.EXPLICA_ENTITY_PAYMENTMETHOD_ID;

	}

	@Override
	public long getInternalId() {

		return idPaymentMethod;
	}

	@Override
	public String getInternalValue() {

		return description;
	}












	public void setVersion(Integer version) {
		this.version = version;
	}








	public long getIdPaymentMethod() {
		return idPaymentMethod;
	}








	public void setIdPaymentMethod(long idPaymentMethod) {
		this.idPaymentMethod = idPaymentMethod;
	}








	public long getDaysFirstPayment() {
		return daysFirstPayment;
	}








	public void setDaysFirstPayment(long daysFirstPayment) {
		this.daysFirstPayment = daysFirstPayment;
	}








	public long getNumberPayments() {
		return numberPayments;
	}








	public void setNumberPayments(long numberPayments) {
		this.numberPayments = numberPayments;
	}








	public long getDaysBetweenPayments() {
		return daysBetweenPayments;
	}








	public void setDaysBetweenPayments(long daysBetweenPayments) {
		this.daysBetweenPayments = daysBetweenPayments;
	}











	   public boolean isCash() {
		return cash;
	}








	public void setCash(boolean isCash) {
		this.cash = isCash;
	}








	public boolean isBatch() {
		return batch;
	}








	public void setBatch(boolean batch) {
		this.batch = batch;
	}








	@Override
	    public int hashCode() {
	        final HashCodeBuilder hcb = new HashCodeBuilder();
	        hcb.append(getDescription());
	        return hcb.toHashCode();
	    }

	    
	    
	    @Override
	    public boolean equals(Object obj) {
	        boolean isEquals = false;
	        try {
	            final PaymentMethodOT other = (PaymentMethodOT)obj;
	            final EqualsBuilder eqb = new EqualsBuilder();
	            eqb.append(getDescription(), other.getDescription());
	            isEquals = eqb.isEquals();

	        } catch (Exception e) {
	            isEquals = false;
	        }

	        return isEquals;
	    }


	



	
	
}
